<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdvanceCardsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('advance_cards', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->unsignedInteger('total_count')->comment('总垫付次数');
            $table->decimal('deposit_amount', 10, 2)->comment('保证金金额');
            $table->unsignedInteger('used_count')->default(0)->comment('已用次数');
            $table->unsignedInteger('used_amount')->default(0)->comment('已用保证金');
            $table->decimal('consume_beans', 10, 2)->comment('KC通证');
            $table->tinyInteger('status')->default(1)->comment('1-待审核,2-已审核,3-已失效');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `advance_cards` comment '垫付卡'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('advance_cards');
    }
}
